home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Games of Daze
/
Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso
/
x2ftp
/
msdos
/
memory
/
realflat
/
realflat.txt
< prev
Wrap
Internet Message Format
|
1994-10-30
|
4KB
From frendzel@gary.com Sun Oct 30 20:11:28 1994
Date: Fri, 28 Oct 94 14:20:46 EST
From: frendzel@gary.com
Newsgroups: rec.games.programmer
Organization: Gary's Place BBS
Subject: REAL FLAT MODE
Someone here wanted to know about 32 bit real mode, well here is a post
that might help you out, from FidoNet 80x86 (Assembler Programming)
One you you bi-lingual-ites could help translating the spanish comments
to english.
Carl Frendzel frendzel@gary.com preferred
cfrendzel@delphi.com not used much unless ftp'n to
x2ftp!<G>.
------------------------------------------------------------------------
Msg: #49
Date: 10-21-94 01:51 (Public)
From: Jon Beltran de Heredia
To: All
Subject: Real flat mode
Hello, All!
As I've seen lots of misunderstanding on the deal of real flat mode, I'm
posting a little piece of it. I did it several months ago...
The worst things I have heard are that:
'...real mode segments that begin in 64K boundaries (base=seg SHL 16)...'
'...and then you switch to real mode by resetting the CPU...'
(that was a 286'er, hey?)
IDEAL
MODEL SMALL
P386
STACK
DATASEG
; Tabla de descriptores
LABEL DescTabl
DB 8 DUP (?) ; Descriptor 0 no utilizado
DW 0FFFFh ; 4 Gigabyte (64K pag) de tama$o
DW 0 ; b15..0 del origen
DB 0 ; b23..16 del origen
DB 10010010b ; b7: presente (s! = 1)
; b65: privilege level (00)
; b4: segmento de sistema: (no=1)
; b3: no ejecutable (0)
; b2: no hacia abajo (0)
; b1: escribible (1)
; b0: acceso (no a#n)
DB 11001111b ; b7: granularidad (p ginas = 1)
; b6: grande (?) (s! = 1)
; b5: (?) (0)
; b4: no utilizado (0)
; b30: 19..16 del l!mite (1111)
DB 0 ; b31..24 del origen del segmento
texto DB 'E s t o e s e l t e x t o ! '
SCREEN_ADDR EQU 0B8000h
CODESEG
gdtref DW 0Fh ; l!mite de la gdt: 2 descriptores
l_ref DW OFFSET DescTabl, 0
start: mov ax,@DATA
mov ds,ax
; Have to fix up the gdt reference
mov eax,@DATA
shl eax,4
add [DWORD PTR l_ref],eax
lgdt [FWORD PTR cs:gdtref]
mov eax,cr0
or al,1
mov cr0,eax
jmp @@n
@@n:
; YA ESTAMOS EN PMODE!!!!!!!!!!!
[B mov ax,8
mov fs,ax ; Selector del segmento plano de 4 gigas
mov eax,cr0
and al,0FEh
mov cr0,eax
; ya estamos en rmode :_(((((((((
; PERO CON UN SEGMENTO DE 4 GIGAS!!!!
mov ecx,9 ; longitud del texto en dwords
mov si,OFFSET texto
mov edi,SCREEN_ADDR
@@l: mov eax,[si]
mov [fs:edi],eax
add si,4
add edi,4
loopd @@l
; Espera que se pulse una tecla
mov ah,0
int 16h
xor ax,ax
mov fs,ax
mov ax,4C00h
int 21h
END start
For TASM. Comments in spanish, sorry... the code should be readily
understandable. And by the way, this only works with the processor in real mode
(with no memory manager or just poor old HIMEM). You should check that yer not
in v86 just with SMSW AX//TEST AX,1//JNZ @@badluck. Don't use MOV ExX,CR0 'cos
it could cause an exception (it's privileged).
Cheers, :-)
Jon
--- FMail 0.92
* Origin: Yann/Iguana (2:343/121.8)
*** Gary's Place BBS - 412 326-4039 - Internet e-mail and news ***